import React from 'react'
import { Button, Form, ImageUploader, Input, NavBar, Modal } from 'antd-mobile'
import axios from 'axios'
import { useState } from 'react'
// import { demoSrc, mockUpload, mockUploadFail } from './utils'
import { AddOutline } from 'antd-mobile-icons'
function Home() {

  // const [fileList, setFileList] = useState([])

  // const handleUpload = async () => {
  //   // 调用app上传
  //   const res = await axios.post('/api/orc/upload/image')
  //   console.log(res);

  //   const { code, data } = res.data
  //   if (code == 200) {
  //     console.log(data);

  //   }

  // }

  const onFinish = async (value) => {

    const res = await axios.post('/api/orc/upload/image')
    console.log(res);

    const { code, data } = res.data
    if (code == 200) {
      console.log(data);

    }


  }
  return (
    <div>
      <NavBar >新增乘客</NavBar>

      <Button onClick={() => {
        Modal.alert({
          content: '人在天边月上明',
          onConfirm: () => {
            console.log('Confirmed')
          },
        })
      }} block size='large'>
        扫描证件添加
      </Button>


      <Form
        name='form'
        onFinish={onFinish}
        footer={
          <Button block type='submit' color='primary' size='large'>
            提交
          </Button>
        }
      >
        <Form.Item name='name' label='乘客类型' rules={[{ required: true }]}>
          <Input placeholder='请输入姓名' />
        </Form.Item>
        <Form.Item name='name' label='姓名' rules={[{ required: true }]}>
          <Input placeholder='请输入姓名' />
        </Form.Item>
        <Form.Item name='name' label='证件类型' rules={[{ required: true }]}>
          <Input placeholder='请输入姓名' />
        </Form.Item>
        <Form.Item name='name' label='证件号码' rules={[{ required: true }]}>
          <Input placeholder='请输入姓名' />
        </Form.Item>
        <Form.Item name='name' label='手机号码' rules={[{ required: true }]}>
          <Input placeholder='请输入姓名' />
        </Form.Item>

      </Form>


    </div>
  )
}

export default Home